cmake_minimum_required (VERSION 2.8)

# This adds precompilede headers.
# Do not add stdafx.cpp to the sources in CMakeLists.
# Add sources that use precompiled headers before this macro.
# Add sources that do not use precompiled headers after this macro.

macro(ADD_MSVC_PRECOMPILED_HEADER PrecompiledHeader PrecompiledSource SourcesVar)
	if(MSVC)
		GET_FILENAME_COMPONENT(PrecompiledBasename ${PrecompiledHeader} NAME_WE)
		set(PrecompiledBinary "${CMAKE_CURRENT_BINARY_DIR}/$(IntDir)/${PrecompiledBasename}.pch")
		set(Sources ${${SourcesVar}})

		SET_SOURCE_FILES_PROPERTIES(${PrecompiledSource}
									PROPERTIES COMPILE_FLAGS "/Yc\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\" /Yl\"${PrecompiledBasename}\""
											   OBJECT_OUTPUTS "${PrecompiledBinary}")
		SET_SOURCE_FILES_PROPERTIES(${Sources}
									PROPERTIES COMPILE_FLAGS "/Yu\"${PrecompiledHeader}\" /Fp\"${PrecompiledBinary}\" /Yl\"${PrecompiledBasename}\" /FI\"${PrecompiledHeader}\""
											   OBJECT_DEPENDS "${PrecompiledBinary}")  
		# Add precompiled header to SourcesVar
		LIST(APPEND ${SourcesVar} ${PrecompiledSource})
	endif(MSVC)
endmacro(ADD_MSVC_PRECOMPILED_HEADER)

project(bmock)

if (BOOST_LIBRARYDIR)
else()
	set(BOOST_LIBRARYDIR $ENV{BOOST_LIBRARYDIR})
endif()

FIND_PACKAGE(Boost REQUIRED)
MESSAGE("Boost information:") 
MESSAGE("  Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") 
MESSAGE("  Boost_LIBRARIES: ${Boost_LIBRARIES}") 
MESSAGE("  Boost_LIBRARY_DIRS: ${Boost_LIBRARY_DIRS}") 
MESSAGE("  Boost_LIBRARYDIR: ${BOOST_LIBRARYDIR}") 
if (Boost_FOUND)
	INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
	LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
endif()

LINK_DIRECTORIES(
	${BOOST_LIBRARYDIR}
)

include_directories(
	libbmock/inc
)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR CMAKE_COMPILER_IS_GNUCXX)
	add_definitions("-std=c++0x")
endif()

add_subdirectory(libbmock)
add_subdirectory(test_bmock_raw_mem)
add_subdirectory(test_bmock_argument)
add_subdirectory(test_bmock_expectation)
add_subdirectory(test_bmock)
add_subdirectory(test_bmock_dynamic_mocks)
